import pandas as pd

for i in range(1,8):
    new_df = pd.read_csv(f'{i}.csv')
    old_df = pd.read_csv(f'./merged_output/{i}.csv')
    # 提取气压和Date
    old_df1 = old_df[['date', '气压']]
    old_df1.rename(columns={'气压': 'pressure'}, inplace=True)
    old_df1 = old_df1[-5:]  # 取最后5行
    new_df1 = new_df[['date', 'predicted_pressure']]
    new_df1.rename(columns={'predicted_pressure': 'pressure'}, inplace=True)
    new_df = pd.concat([old_df1, new_df1], axis=0)
    print(new_df)
    new_df.to_csv(f'./pressure/{i}.csv', index=False)